package com.vn.gofriends.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.vn.gofriends.R;

public class MyTripsAdapter extends ArrayAdapter<String> {

	Context context;
	List<String> arrsName;
	int res;

	public MyTripsAdapter(Context context, int resource,
			List<String> arrsName) {
		super(context, resource, arrsName);
		this.context = context;
		this.arrsName = arrsName;
		this.res = resource;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		if (view == null) {
			view = ((LayoutInflater) context
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
					.inflate(res, parent, false);
		}
		String str = arrsName.get(position);
		if (str != null) {
			TextView txtNameTrip = (TextView) view
					.findViewById(R.id.txtNamePlace);
			txtNameTrip.setText(str);
		}
		return view;
	}
}
